package com.kelp.codetoolkit.enums

import java.util.regex.Pattern

/**
 * @author: liuyuebai
 * @date: 2024/8/3 09:19
 * @description:
 */
enum class MySQLDataTypeDefaultValueEnum(val jType:String,val mType:String, val defaultValue:String){
    NONE("none","none","none"),
    BIGINT("java.lang.Long","bigint(17)","0"),
    DATETIME("java.time.LocalDateTime","datetime","CURRENT_TIMESTAMP"),
    DECIMAL("java.math.BigDecimal","decimal(20,4)","0.000"),
    INT("java.lang.Integer","int(11)","0"),
    VARCHAR("java.lang.String","varchar(255)","''"),

    ;



   companion object{
       fun getTypeDefaultValue(jType:String): MySQLDataTypeDefaultValueEnum {
           MySQLDataTypeDefaultValueEnum.values().forEach { it ->
               if (it.jType == jType) {
                   return it
               }
           }
           return NONE;
       }

       fun isLocalDateTime(jType:String):Boolean{
           return DATETIME.jType == jType
       }

       fun isDigits(jType:String):Boolean{
           return BIGINT.jType == jType ||INT.jType == jType
       }
   }
}